<template>
<div>
  <header-nav></header-nav>
    <van-notice-bar left-icon="volume-o" :scrollable="false">
  <van-swipe
    vertical
    class="notice-swipe"
    :autoplay="3000"
    :show-indicators="false"
  >
    <van-swipe-item v-for="(item,index) in items" :key="index">
      {{item.nickname}}  <span>刚参加了活动</span>  {{item.name}}
    </van-swipe-item>
  </van-swipe>
</van-notice-bar>

<div class="hot">
  <h2>热门活动上线中</h2>
  <ul>
    <li v-for="item in hots" :key="item.id">
      <div class="img">
        <img :src="item.image" alt="">
      </div>
      <div class="join">
        <div class="join_left">
          {{item.name}}
        </div>
        <div class="join_right">
          立即参与 >
        </div>
      </div>
    </li>
  </ul>
</div>

<div class="hot">
  <h2>往期回顾</h2>
  <ul>
    <li v-for="item in olds" :key="item.id">
      <div class="img">
        <img :src="item.image" alt="">
      </div>
      <div class="join">
        <div class="join_left">
          {{item.name}}
        </div>
        <div class="join_right">
          查看详情 >
        </div>
      </div>
    </li>
  </ul>
</div>


  
</div>
  
</template>

<script>
import headerNav from "../components/base/headerNav.vue"
import {getHomeEvents} from "../api/activity"
export default {
  data(){
    return{
      items:[],
      hots:[],
      olds:[]
    }
  },
  created(){
      getHomeEvents({offset:0,limit:20}).then(data=>{
        this.items = data.data.banner;
        this.hots = data.data.ongoing.events;
        this.olds = data.data.ended.events
        console.log( data.data.ongoing.events);
      })
  },
    components:{
        headerNav,
       
    }
}
</script>

<style lang="less">
  .notice-swipe {
    height: 40px;
    line-height: 40px;
  }
  .van-notice-bar{
    margin-left: 3%;
    width: 85%;
    background-color:#F5F5F5;
    color: #222222;
    font-weight: bold;
    span{
      color: #3B3B3B;
      font-weight: normal;
    }
  }

  .hot{
    margin:0px 15px;
    margin-top: 21px;
    h2{
      font-size: 18px;
      line-height: 18px;
      font-weight: bold;
    }
    ul{
      li{
        margin-top: 18px;
        .img{
          width: 100%;
          img{
            width: 100%;
            height: 100%;
          }
        }
        .join{
          margin-top: 11px;
          display: flex;
          justify-content: space-between;
          align-items:center;
          .join_left{
            font-size: 14px;
            line-height: 18px;
            font-weight: bold;
            width: 75%;
          }
          .join_right{
            font-size: 14px;
            line-height: 14px;
            color: #1B737F;
          }
        }
      }
    }
  }
</style>